#include <iostream>
#include <vector>
using namespace std;
class Graph{
private:
    int node_nums;
    vector<bool> visited;
    vector<vector<int>> adj;
    int depth;
public:
    Graph(const vector<vector<int>>& j);
    void show();
    void DFS(int start_node,int end_node);
};
Graph::Graph(const vector<vector<int>>& a){
    depth = 0;
    adj = a;
    visited = vector<bool>(adj.size(),true);
}
void Graph::show() {
    cout<<"最大深度为:"<<depth<<"\n";
    cout<<"最小路径为:"<<2*(adj.size()-1)-depth<<"\n";
}
void Graph::DFS(int start_node,int end_node) {
//    bool flag = true;
    visited[start_node] = false;
    for(int i=0;i<adj.size();i++){
        if( visited[i] && adj[start_node][i] == 1){
//            flag = false;
            DFS(i,end_node+1);
        }
    }
    if(end_node>depth)
        depth = end_node;
//    if(flag){
//        if(end_node>depth)
//        {
//            depth = end_node;
//        }

//    }
}
int main() {
//    vector<vector<int>> j = {{0,1,1,0,0,0},
//                            {1,0,0,0,0,0},
//                            {1,0,0,1,1,0},
//                            {0,0,1,0,0,0},
//                            {0,0,1,0,0,1},
//                            {0,0,0,0,1,0}};
    int n;
    while(cin>>n)
    {
        vector<vector<int>> j(n,vector<int>(n,0));
        int a,b;
        for(int i=0;i<n-1;i++)
        {
            cin>>a>>b;
            j[a-1][b-1] = 1;
            j[b-1][a-1] = 1;
        }
        Graph g = Graph(j);
        g.DFS(0,0);
        g.show();
    }
    return 0;
}